package io.shallwe.common.db;

import io.shallwe.common.utils.StrUtil;

import javax.sql.DataSource;

public class DataSourceBuilder {
    private DataSourceConfig config;
    public DataSourceBuilder(DataSourceConfig datasourceConfig) {
        this.config = datasourceConfig;
    }

    public DataSource build() {
         DataSource dataSource = this.createDataSource(this.config);
         return  dataSource;
    }

    private DataSource createDataSource(DataSourceConfig dataSourceConfig) {
       return new DruidDataSourceFactory().createDataSource(dataSourceConfig);
    }
}